package controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloController implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {

        System.out.println("HelloController===>>>");

       ModelAndView mv = new ModelAndView();
       //存入要显示的数据（model）
        mv.addObject("msg","hello springMvc");
        //指定显示的view(视图)  hello是试图的名字
        mv.setViewName("hello");

        return mv;
    }
}
